<template>
  <div class="pagination">
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page.sync="form.page"
      :page-sizes="[20]"
      :page-size="form.size"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total"
    >
    </el-pagination>
  </div>
</template>

<script>
export default {
  props:{
    total:{
      type:Number,
      default: 1
    },
    form:{
      type:Object,
      default: { page:1, size: 20 }
    }
  },
  watch:{
    total(val){
      this.total = val
    }
  },
  methods: {
    // 当页展示数量改变时
    handleSizeChange(e) {
      this.form.size = e
      this.form.page = 1
      this.$emit("paginationPostOrderTaskList",this.form)
    },
    // 页码改变时
    handleCurrentChange(e){
      this.form.page = e;
      this.$emit("paginationPostOrderTaskList",this.form)
    },
  },
};
</script>

<style lang="scss" scoped>
.pagination {
  margin-top:10px;
  border-top: 1px solid #efefef;
  padding:5px 0;
  text-align: right;
}
</style>